package com.app.community.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 *  2020/10/14 20:28
 **/
@Mapper
public interface RegisterMapper {

    /**
     * 注册用户
     */
    @Insert({"insert into user(user_id,password,avatar,nick_name) values (#{userId},#{password},#{avatar},#{nickName})"})
    void registerUser(@Param("userId")String userId,@Param("password")String password,@Param("avatar")String avatar,@Param("nickName")String nickName);

    /**
     * 查询用户是否存在
     * 存在返回1不存在返回null
     */
    @Select({"select true from user where user_id = #{userId}"})
    Integer isUserExist(@Param("userId")String userId);

}
